package com.castile.secondkill.tester;

import com.castile.secondkill.dao.UserDOMapper;
import com.castile.secondkill.dataobject.UserDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试Controller
 *
 * @author Hongliang Zhu
 * @create 2023-03-04 23:15
 */
@RestController
public class TestController {

    private UserDOMapper userDOMapper;

    @Autowired
    public void setUserDOMapper(UserDOMapper userDOMapper) {
        this.userDOMapper = userDOMapper;
    }

    @RequestMapping("/home")
    public String home() {
        UserDO userDO = userDOMapper.selectByPrimaryKey(1);
        if (userDO == null) {
            return "用户不存在";

        }
        return userDO.getName();

    }
}
